
"""
from sqlalchemy import create_engine,Table,MetaData,column
from sqlalchemy.orm import scoped_session, sessionmaker
import pymysql
# from app.core import config

# engine = create_engine(config.SQLALCHEMY_DATABASE_URI, connect_args={"check_same_thread": False})

engine =create_engine("mysql+pymysql://root:root@localhost:3306/test_sql",encoding='utf-8')

db_session = scoped_session(
    sessionmaker(autocommit=False, autoflush=False, bind=engine)
)
Session = sessionmaker(autocommit=False, autoflush=False, bind=engine)
metadata = MetaData()

def query_all_user(username):
    # user = session1.query(User).filter(User.id == '5').one()
    query_user_table = Table('tb_userorg_framework', metadata, autoload=True, autoload_with=engine)
    a = session1.query(query_user_table).filter_by(Depart_Rank=1).all()
    print(a)
    b = session1.query(query_user_table.Depart_Rank).all()
    print(b)
    session1.close()


if __name__ == '__main__':
    session1 = Session()
    query_all_user("hahaha")
"""


import pymysql

#本地
# db_sys = pymysql.connect("localhost", "root", "root", "oil_measures_sys")
#服务器数据库
db_sys = pymysql.connect(("47.96.235.182", "root", "mysqlUSE80.", "oil_web_project"))

# 服务器 host="localhost", user="root", password="xxx", database="xxxx"
# db_sys = pymysql.connect(host="localhost",user="root",password="mysqlUSE80.",database="oil_web_project")

# 使用 cursor() 方法创建一个游标对象 cursor
cursor_sys = db_sys.cursor()






